#include "aicommandinform.h"

namespace IAlib
{

AiCommandInform::AiCommandInform()
{
    AiCommand::setType(COMMAND_INFORME);
}

QByteArray AiCommandInform::toByteArray() const
{
    QByteArray byte_array;
    QDataStream data(&byte_array, QIODevice::WriteOnly);

    data<<getMode();
    data<<getAgentId();
    data<<getFactName();
    data<<getFactState();

    return byte_array;
}

void AiCommandInform::fromByteArray(QByteArray &byte_array)
{
    QDataStream data(&byte_array, QIODevice::ReadOnly);
    int i_temp;
    data>>i_temp;
    setMode((AiCommand::CommandMode)i_temp);
    data>>m_agent_id;
    data>>m_fact_name;
    data>>m_fact_state;
}

}
